//
//  MenuButton.m
//  iBook
//
//  Created by wangjing on 14/12/6.
//  Copyright (c) 2014年 wikiflyer. All rights reserved.
//

#import "MenuButton.h"

@implementation MenuButton

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    [self setSpotlightCenter:CGPointMake(frame.size.width/2, frame.size.height*(-1)+10)];
    [self setBackgroundColor:[UIColor clearColor]];
//    [self setSpotlightStartRadius:0];
//    [self setSpotlightEndRadius:frame.size.width/2];
    frame.origin.y -= 2.0;
    self.title = [[UILabel alloc] initWithFrame:frame];
    self.title.textAlignment = NSTextAlignmentCenter;
    self.title.backgroundColor = [UIColor clearColor];
//    self.title.textColor = [UIColor blueColor];
    self.title.font = [UIFont boldSystemFontOfSize:16.0];
    self.title.shadowColor = [UIColor darkGrayColor];
    self.title.shadowOffset = CGSizeMake(0, -1);
    [self addSubview:self.title];
    
    self.arrow = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_down.png"]];
    [self addSubview:self.arrow];
    
    return self;
}
-(void)layoutSubviews{
    [self.title sizeToFit];
    self.title.center = CGPointMake(self.frame.size.width/2, (self.frame.size.height-2.0)/2);
//    self.arrow.center = CGPointMake(CGRectGetMaxX(self.title.frame) + [SIMenuConfiguration arrowPadding], self.frame.size.height / 2);
    self.arrow.center = CGPointMake(CGRectGetMaxX(self.title.frame)+13, self.frame.size.height/2);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
